package com.ftg.learn.springboot.comment.service;

import com.ftg.learn.springboot.comment.mapper.commentMapper;
import com.ftg.learn.springboot.comment.pojo.comment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.UUID;

@Service
public class commentService {

	@Autowired
	commentMapper cm;


	public int pageView() {
		return cm.pageView();
	}

	public List<comment> showAA() {

		return cm.showAA();
	}
	//查个数
	public int countall(){
		return  cm.countall();
	}
	public int addComment(comment comment){

		return cm.addComment(comment);
	}

	public List<comment> randomComment() {

		return cm.randomComment();
	}
	public int findBidcountByBname(String bname){

		return cm.findBidcountByBname(bname);
	}

	public int addCommentByBname(comment comment) {

		comment.setBid(cm.findBidByBname(comment.getBname()));
		comment.setCid(UUID.randomUUID().toString());
		return cm.addComment(comment);
	}
}
